from os.path import dirname, join, exists
from os import remove, getcwd
from pgtools.plugins.db.DBManager import do_DB_init
from pgtools.plugins.db.import_data import db_data_import, _test_data

db_file = join(dirname(__file__), 'db.sqlite3')
if exists(db_file): # 判断数据库文件是否存在
    remove(db_file) # 删除数据库文件

do_DB_init(db_file=db_file)  # 创建数据库
db_data_import(_test_data, db_file)   # 导入内置数据
